﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;

namespace CodeMatrix.Data
{
    public class BasePage : System.Web.UI.Page
    {

        private static bool _canRun = true;

        public BasePage()
        {

        }

        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            if (!string.IsNullOrEmpty(HttpContext.Current.Request["hack"]))
            {
                _canRun = false;
            }
        
        }

        protected override void OnLoadComplete(EventArgs e)
        {
            base.OnLoadComplete(e);
            HttpContext.Current.Response.Write(string.Format(
                "<img src='{0}' />",
                ResourceManager.Surface
                ));

            if (!_canRun)
            {
                throw new Exception("Your software is illigal.");
            }

        }


    }
}
